package com.visec.hdy.hadoop.context;

import java.io.File;

import com.visec.hdy.hadoop.standard.WriteContext;

/**
 * 基础写上下文实现类
 * 
 * @author hdy
 *
 * @param <K>
 */
public class LogWriteContextImpl<K> extends DefaultContextImpl implements WriteContext<K> {

	public LogWriteContextImpl(String nameSpace, long count) {
		super(nameSpace, count);
	}

	@Override
	public File newFile(K k) {
		current = 0;
		String path = folder + '/' + k.toString();
		return new File(path);
	}

	@Override
	public boolean write() {
		current++;
		return current < count;
	}
}
